Ext.define('DutyList.calendar.data.SheduleModel', {
    extend: 'Ext.data.Model',
    
    requires: [
        'Ext.util.MixedCollection',
        'DutyList.calendar.data.SheduleMappings'
    ],
    
    statics: {
        reconfigure: function() {
            var Data = DutyList.calendar.data,
                Mappings = Data.SheduleMappings,
                proto = Data.SheduleModel.prototype,
                fields = [];

            proto.idProperty = Mappings.SheduleId.name || 'id';
            
            for(prop in Mappings){
                if(Mappings.hasOwnProperty(prop)){
                    fields.push(Mappings[prop]);
                }
            }
            proto.fields.clear();
            for(var i = 0, len = fields.length; i < len; i++){
                proto.fields.add(Ext.create('Ext.data.Field', fields[i]));
            }
            return Data.SheduleModel;
        }
    }
},
function(){
    DutyList.calendar.data.SheduleModel.reconfigure();
});